package goodenglish.interfaces.javafxex;

import javafx.scene.control.TextArea;

public class MyTextArea extends MyPane {
	private TextArea textArea;

	public MyTextArea(String title) {
		super(title);
		this.setStyle("-fx-border-color: black;-fx-border-width: 2;-fx-font-size:20;");
		this.setMaxWidth(300);
		this.setMinWidth(300);
		textArea = new TextArea("编辑解释");

		textArea.setWrapText(true);

		textArea.setEditable(false);
		this.getChildren().add(textArea);
	}

	public MyTextArea(String title, int width, int height) {
		this(title);
		this.setMaxWidth(width);
		this.setMinWidth(width);
		this.setMaxHeight(height);
		this.setMinHeight(height);
		textArea.setMaxHeight(height - labelHeight);
		textArea.setMinHeight(height - labelHeight);

	}

	public MyTextArea(String title, int width, int height, boolean editAble) {
		this(title, width, height);
		textArea.setEditable(editAble);
	}

	public void setText(String text) {
		textArea.setText(text);
	}

	public String getText() {
		return this.textArea.getText();
	}
}
